package com.talent.service.iot.mqtt.codec.decoder;

import com.talent.service.iot.mqtt.model.fix.TlMqttFixedHead;
import com.talent.service.iot.mqtt.model.request.TlMqttHeartBeatReq;
import io.netty.handler.codec.mqtt.MqttMessageType;
import org.springframework.stereotype.Component;

/**
 * @ClassName：TlConnectDecoder
 * @Author: hszhou
 * @Date: 2024/11/30 15:12
 * @Description: 心跳包解码器
 */
@Component
public class TlMqttHeartBeatDecoder {

    public TlMqttHeartBeatReq build( int remainingLength){
        TlMqttFixedHead fixedHead = decodeFixedHeader( remainingLength);
        return new TlMqttHeartBeatReq(fixedHead);
    }

    TlMqttFixedHead decodeFixedHeader(int remainingLength) {
        TlMqttFixedHead fixedHead =new TlMqttFixedHead();
        fixedHead.setMessageType(MqttMessageType.PINGRESP);
        fixedHead.setLength(remainingLength);
        return fixedHead;
    }

}
